from django import forms
from .models import Author
from django.forms import widgets
from django.forms import fields
from django.db.models import Q

class AuthorForm(forms.Form):
    name = forms.CharField(max_length=20, label='姓名')
    age = forms.IntegerField(max_value=100)
    gender = forms.ChoiceField(choices=Author.GENDER)


class BlogForm(forms.Form):
    title = forms.CharField(max_length=255)
    content = forms.CharField(widget=widgets.Textarea)
    author = forms.ModelChoiceField(queryset=Author.objects.all())
